import { Component, Input, Output, EventEmitter } from '@angular/core';
import type { TodoItem } from '../index';

@Component({
  selector: 'app-todo-list',
  templateUrl: './todo-list.component.html',
  styleUrls: ['./todo-list.component.css'],
})
export class TodoListComponent {
  @Input() todoList: Array<TodoItem> = [];
  @Output() public removeTodoEvent = new EventEmitter<number>();
  @Output() public todoCheckStatusChangeEvent = new EventEmitter<void>();
  constructor() {}

  public removeTodo(todoIndex: number) {
    this.removeTodoEvent.emit(todoIndex);
  }
  public todoCheckStatusChange() {
    this.todoCheckStatusChangeEvent.emit();
  }
}
